package com.news.gpb.service.impl;

import com.news.gpb.dao.CardDao;
import com.news.gpb.entity.Card;
import com.news.gpb.service.CardService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.sql.Date;
import java.util.List;

@Service("cardService")
public class CardServiceImpl implements CardService {

    @Autowired
    CardDao cardDao;

    @Override
    public int cardCount(int user_id) {
        return cardDao.countCollect(user_id);
    }

    @Override
    public List<Card> getCard(Card card) {
        return cardDao.getCard(card.getUser_id());
    }

    @Override
    public List<Card> reviewCard(Card card) {
        List<Card> cards = cardDao.reviewCard(card.getUser_id());
        for(Card card1:cards)
        {
            cardDao.updateCard(card1.getCard_id());
        }
        return cards;
    }

    @Override
    public Integer makeCard(Card card) {
        return cardDao.makeCard(card);
    }

    @Override
    public Integer removeCard(Card card) {
        return cardDao.removeCard(card.getCard_id());
    }

}
